package Java_Concurrency_in_Practice.c5_6;

import java.math.BigInteger;

public class Factorizer {

    private  final Computable<BigInteger, BigInteger[]> c = new Computable<BigInteger, BigInteger[]>() {
        @Override
        public BigInteger[] compute(BigInteger arg) throws InterruptedException {
            return factor(arg);
        }
    };

    private BigInteger[] factor(BigInteger arg) {
        return new BigInteger[]{};
    }

    private final Computable<BigInteger, BigInteger[]> cache = new Memoizer4<BigInteger, BigInteger[]>(c);

    public void service(BigInteger i) {
        try {
            cache.compute(i);
        } catch (InterruptedException e) {
            e.printStackTrace();
        }
    }
}
